I. Field
The present invention relates generally to computer processing, and more specifically to techniques for setting events in a multi-threaded system.
II. Background
Operating systems are one common type of a multi-threaded system. An operating system manages various system resources (e.g., hardware units, storage devices, interfaces, and so on) and provides services that allow applications running over the operating system to access the system resources. The operating system typically provides these services via threads that are invoked, scheduled, and processed as appropriate. A thread may be viewed as a task to be performed.
Real-time operating systems are one class of operating systems and are commonly used for many electronic devices such as wireless devices (e.g., cellular phones), digital personal assistants (PDAs), and so on. A key attribute of a real-time operating system is preemptive priority-based scheduling. This type of scheduling attempts to schedule threads such that the thread with the highest priority among all threads that are ready for execution is processed first. Each thread is associated with a particular priority and possibly an event that needs to be set before the thread can be processed. Whenever an event is set, the operating system determines which threads are ready for execution (i.e., not waiting on any event, or waiting on an event that has been set) and schedules the highest priority thread that is ready. The thread that is currently being processed may be preempted by another thread having a higher priority and ready for execution.
A real-time operating system may allow an active thread to set a single event at a time. However, the active thread may have multiple events to set, and the order in which the active thread sets these events may affect the order in which threads are scheduled, as described below. System performance may be degraded if threads are scheduled in an undesirable order due to the order in which the events are set.
There is therefore a need in the art for techniques to set events in a multi-threaded system.